package com.platform.feign.spring.enums;


import org.apache.commons.lang3.StringUtils;

public interface BaseEnum {

    String getCode();

    static <E extends BaseEnum> E getByCode(String code, Class<E> enumClass) {
        E[] var2 = enumClass.getEnumConstants();
        for (E item : var2) {
            if (item.getCode().equals(code)) {
                return item;
            }
        }
        return null;
    }
    
    static <T extends Enum<T>> T getEnum(String enumName, Class<T> enumClass) {
        if (StringUtils.isBlank(enumName)) {
            return null;
        }
        try {
            return Enum.valueOf(enumClass, enumName);
        } catch (IllegalArgumentException var3) {
            return null;
        }
    }

}